#ifndef SOLUTION_H_
#define SOLUTION_H_
class Solution {
public:
    void merge(int A[], int m, int B[], int n) {
        // Start typing your C/C++ solution below
        // DO NOT write int main() function
        int curIdx = m+n-1, ia = m-1, ib = n-1;
		while((ia>=0)&&(ib>=0))
		{
			if(A[ia]>=B[ib])
			{
				A[curIdx] = A[ia];
				ia--;
			}
			else
			{
				A[curIdx] = B[ib];
				ib--;
			}
			curIdx--;
		}

		if(ia<0)
		{
			while(ib>=0)
			{
				A[curIdx] = B[ib];
				curIdx--;
				ib--;
			}
		}
    }
};
#endif
